/*
 * 3.95 TFT, 480x480, ST7701 driver ic, rgb666 interface
 * LCM outline size 84.2(H)x84.2(V)
 * Active area 71.86(H)x70.18(V)
 * If=40mA(type), Vf=12V(type)
 * ---------------------------------------------
 * pin  -   description
 * 1    -   LEDA            * 2    -   LEDK
 * 3    -   LEDK            * 4    -   GND
 * 5    -   VCC             * 6    -   RESET
 * 7    -   NC              * 8    -   NC
 * 9    -   SDA             * 10   -   SCL
 * 11   -   CS              * 12   -   DCLK
 * 13   -   DE              * 14   -   VS
 * 15   -   HS              * 16   -   DB0
 * 17   -   DB1             * 18   -   DB2
 * 19   -   DB3             * 20   -   DB4
 * 21   -   DB5             * 22   -   DB6
 * 23   -   DB7             * 24   -   DB8
 * 25   -   DB9             * 26   -   DB10
 * 27   -   DB11            * 28   -   DB12
 * 29   -   DB13            * 30   -   DB14
 * 31   -   DB15            * 32   -   DB16
 * 33   -   DB17            * 34   -   GND
 * 35   -   TPINT           * 36   -   TPSDA
 * 37   -   TPSCL           * 38   -   TPRST
 * 39   -   TPVDD           * 40   -   TPGND
 * ---------------------------------------------
 * 
 */
#ifndef LCD_HXR040_H
#define LCD_HXR040_H

#include "lcd.h"
#include "hal_drv.h"

typedef struct
{
    void *bus_handle;
    lcd_bus_t *bus;

    lcd_base_t base;
    
    uint16_t x_offset;
    uint16_t y_offset;
    
    SemaphoreHandle_t draw_complete;
    
}lcd_HXR040_t;

extern void lcd_HXR040_init(lcd_HXR040_t *t);
extern void lcd_HXR040_reg_init(lcd_HXR040_t *t);
extern void lcd_HXR040_draw_rect(lcd_HXR040_t *t, uint16_t x0, uint16_t y0, uint16_t x1, uint16_t y1, const uint8_t *color_p);
extern void lcd_HXR040_draw_end(lcd_HXR040_t *t);
extern void lcd_HXR040_draw_complete_wait(lcd_HXR040_t *t);
extern void lcd_HXR040_clear(lcd_HXR040_t *t, uint16_t color);
extern void lcd_HXR040_cmd(lcd_HXR040_t *t, uint8_t cmd);
#endif /* LCD_HXR040_H */
